﻿using System;
using System.Threading;

namespace BlockIngDemo
{
    class Program
    {
        static bool _done;
        static readonly object locker = new object();

        static void Main(string[] args)
        {
            Thread thread = new Thread(Go);
            thread.Start();
            Go();
        }
        static void Go() 
        {
            lock (locker) 
            {
                if (!_done) 
                {
                    Thread.Sleep(30);
                    _done = true;
                    Console.WriteLine("Hello");
                }
            }
        
        }


        //public ThreadState SimpleThreadState(ThreadState ts) 
        //{
        //    return ts & (ThreadState.Unstarted | ThreadState.WaitSleepJoin | ThreadState.Stopped);
        //}
    }
}
